package cn.fl.mcr.transform;

import java.util.ArrayList;
import java.util.List;

import cn.cmm.base.framework.utils.CollectionUtils;
import cn.fl.mcr.vo.McrLoanAccountVO;
import cn.lionbridgecapital.loan.model.dto.McrLoanAccountDTO;


/**
 * @Description: 信托账户 转换器
 * @Description: VO是客户端传递数据到服务端进行转换的数据 
 * @Description: VO转换数据变成DTO传递到服务端 
 * @Description: VO不能在服务端出现
 */
public class McrLoanAccountVOTransform {


	/**
	 * DTO 转  VO
	 * @param po McrLoanAccountDTO
	 * @return McrLoanAccountVO
	 */
	public static McrLoanAccountVO toVO(McrLoanAccountDTO dto) {
		McrLoanAccountVO  vo = null;
		if (dto != null) { 
			vo = new McrLoanAccountVO();
			vo.setId(dto.getId());
			vo.setLoanId(dto.getLoanId());
			vo.setLoanChannel(dto.getLoanChannel());//LOAN_CHANNEL
			vo.setAccountName(dto.getAccountName());//ACCOUNT_NAME
			vo.setAccountNumber(dto.getAccountNumber());//ACCOUNT_NUMBER
			vo.setAccountIniBalance(dto.getAccountIniBalance());//ACCOUNT_INI_BALANCE
			vo.setAccountBalance(dto.getAccountBalance());//ACCOUNT_BALANCE
			vo.setAccountStartdate(dto.getAccountStartdate());//ACCOUNT_STARTDATE
			vo.setAccountEnddate(dto.getAccountEnddate());//ACCOUNT_ENDDATE
			vo.setAccountImmovAmount(dto.getAccountImmovAmount());//ACCOUNT_IMMOV_AMOUNT
			vo.setKnotInterval(dto.getKnotInterval());//KNOT_INTERVAL
			vo.setKnotStarttime(dto.getKnotStarttime());
			vo.setKnotTime(dto.getKnotTime());//KNOT_TIME
			vo.setKontStartday(dto.getKontStartday());//KONT_STARTDAY
			vo.setIsValid(dto.getIsValid());//IS_VALID
			vo.setIsDel(dto.getIsDel());//IS_DEL
			vo.setLoanName(dto.getLoanName());
			vo.setIsGuarantee(dto.getIsGuarantee());
			vo.setIsRealGuaranteeCrt(dto.getIsRealGuaranteeCrt());
			vo.setGuaranteeRateType(dto.getGuaranteeRateType());
			vo.setGuaranteeRateValue(dto.getGuaranteeRateValue());
			vo.setRepoSubject(dto.getRepoSubject());

			vo.setCrtTm(dto.getCrtTm());//创建时间
			vo.setCrtUsrId(dto.getCrtUsrId());//创建人
			vo.setMdfTm(dto.getMdfTm());//修改时间
			vo.setMdfUsrId(dto.getMdfUsrId());//修改人
			vo.setAccountBank(dto.getAccountBank());
			vo.setAccountBankNo(dto.getAccountBankNo());
			vo.setProductCode(dto.getProductCode());
			vo.setLoanCode(dto.getLoanCode());
			vo.setContractCode(dto.getContractCode());
			vo.setAvailableBalance(dto.getAvailableBalance());
			vo.setSimgleAmt(dto.getSimgleAmt());
			vo.setSupportType(dto.getSupportType());
			vo.setSingleChannel(dto.getSingleChannel());
			vo.setProjectCode(dto.getProjectCode());
			vo.setAssetsCode(dto.getAssetsCode());
			vo.setContCfgCd(dto.getContCfgCd());
			vo.setFdAmt(dto.getFdAmt());
		}
		return vo;
	}

	/**
	 * VO 转 DTO
	 * @param dto McrLoanAccountVO
	 * @return McrLoanAccountDTO
	 */
	public static McrLoanAccountDTO toDTO(McrLoanAccountVO vo) {
		McrLoanAccountDTO dto = null;
		if (vo != null) {
			dto = new McrLoanAccountDTO();
			dto.setId(vo.getId());
			dto.setLoanId(vo.getLoanId());
			dto.setLoanChannel(vo.getLoanChannel());//LOAN_CHANNEL
			dto.setAccountName(vo.getAccountName());//ACCOUNT_NAME
			dto.setAccountNumber(vo.getAccountNumber());//ACCOUNT_NUMBER
			dto.setAccountIniBalance(vo.getAccountIniBalance());//ACCOUNT_INI_BALANCE
			dto.setAccountBalance(vo.getAccountBalance());//ACCOUNT_BALANCE
			dto.setAccountStartdate(vo.getAccountStartdate());//ACCOUNT_STARTDATE
			dto.setAccountEnddate(vo.getAccountEnddate());//ACCOUNT_ENDDATE
			dto.setAccountImmovAmount(vo.getAccountImmovAmount());//ACCOUNT_IMMOV_AMOUNT
			dto.setKnotInterval(vo.getKnotInterval());//KNOT_INTERVAL
			dto.setKnotStarttime(vo.getKnotStarttime());
			dto.setKnotTime(vo.getKnotTime());//KNOT_TIME
			dto.setKontStartday(vo.getKontStartday());//KONT_STARTDAY
			dto.setIsValid(vo.getIsValid());//IS_VALID
			dto.setIsDel(vo.getIsDel());//IS_DEL
			dto.setLoanName(vo.getLoanName());
			dto.setIsGuarantee(vo.getIsGuarantee());
			dto.setIsRealGuaranteeCrt(vo.getIsRealGuaranteeCrt());
			dto.setGuaranteeRateType(vo.getGuaranteeRateType());
			dto.setGuaranteeRateValue(vo.getGuaranteeRateValue());
			dto.setRepoSubject(vo.getRepoSubject());

			dto.setCrtTm(vo.getCrtTm());//创建时间
			dto.setCrtUsrId(vo.getCrtUsrId());//创建人
			dto.setMdfTm(vo.getMdfTm());//修改时间
			dto.setMdfUsrId(vo.getMdfUsrId());//修改人
			dto.setAccountBank(vo.getAccountBank());
			dto.setAccountBankNo(vo.getAccountBankNo());
			dto.setProductCode(vo.getProductCode());
			dto.setLoanCode(vo.getLoanCode());
			dto.setContractCode(vo.getContractCode());
			dto.setAvailableBalance(vo.getAvailableBalance());
			dto.setSimgleAmt(vo.getSimgleAmt());
			dto.setSupportType(vo.getSupportType());
			dto.setSingleChannel(vo.getSingleChannel());
			dto.setProjectCode(vo.getProjectCode());
			dto.setAssetsCode(vo.getAssetsCode());
			dto.setContCfgCd(vo.getContCfgCd());
			dto.setFdAmt(vo.getFdAmt());
		}
		return dto;
	}
	
	/**
	 * DTO集合 转 VO集合
	 * @param List<McrLoanAccountDTO>
	 * @return List<McrLoanAccountVO>
	 */
	public static List<McrLoanAccountVO> toVOList(List<McrLoanAccountDTO> list) {
		List<McrLoanAccountVO>  voList = new ArrayList<McrLoanAccountVO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (McrLoanAccountDTO dto : list) {
				voList.add(toVO(dto));
			}
		}
		return voList;
	}
	
	/**
	 * VO集合 转 DTO集合
	 * @param list List<McrLoanAccountVO>
	 * @return List<McrLoanAccountDTO>
	 */
	public static List<McrLoanAccountDTO> toDTOList(List<McrLoanAccountVO> list) {
		List<McrLoanAccountDTO>  dtoList = new ArrayList<McrLoanAccountDTO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (McrLoanAccountVO vo : list) {
				dtoList.add(toDTO(vo));
			}
		}
		return dtoList;
	}
}
